home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / comm / tcp / Amster.lha / Amster_Install / Rexx / AmsterReport.rexx next >
OS/2 REXX Batch file  |  2000-06-18  |  2KB  |  87 lines

  1. /* Scans the Amster.shares file and gives a report on the statistics of 
  2.    your library.  Written by Roger Clark (kaedric@texas.net) 18-Jun-00 */
  3.  
  4. Options Results
  5. Parse Arg ShareList
  6.  
  7. If ShareList = "" then Do
  8.   If ~show(L,"rexxreqtools.library") then Do
  9.     If ~addlib("rexxreqtools.library",0,-30,0) then Do
  10.       Say "Could not access the rexxreqtools.library!"
  11.       Exit 20
  12.     End
  13.   End
  14.   Dir = Pragma("D")
  15.   ShareList = rtfilerequest(Dir,"Amster.shares","Choose Share File",,,)
  16.   If Sharelist = "" then Exit
  17. End
  18.  
  19. If ~Exists(ShareList) then Do
  20.   Say 'Unable to open your library file, 'ShareList' - Exiting'
  21.   Exit
  22. End
  23.  
  24. NumSongs = 0
  25. NumBytes = 0
  26. NumBytesSent = 0
  27. NumReq = 0
  28. NumSecs = 0
  29. TopSongs. = ""
  30. TopSongs.0 = 0
  31. TopReq = 0
  32.  
  33.  
  34.  
  35. Call Open(Out,"Con:20/20/550/300/Amster Library Statistics/Auto/Close/Wait","W")
  36. Call Open(In,ShareList,'R')
  37.   Do Until EOF(In)
  38.     SongName = ""
  39.     MD5 = ""
  40.     Size = 0
  41.     Bitrate = ""
  42.     Frequency = ""
  43.     Play = 0
  44.     ReqCountFlag = ""
  45.     Requests = 0
  46.     Data = ReadLn(In)
  47.     If Length(Data) < 1 then Leave
  48.     Parse Var Data '"'SongName'"' MD5 Size Bitrate Frequency Play ReqCountFlag Requests
  49.     If Requests = "" then Requests = 0
  50.     NumSongs = NumSongs + 1
  51.     NumReq = NumReq + Requests
  52.     If Requests = TopReq then Do
  53.       TopSongs.0 = TopSongs.0 + 1
  54.       Y = TopSongs.0
  55.       TopSongs.Y = SongName
  56.     End
  57.     If Requests > TopReq then Do
  58.       TopReq = Requests
  59.       TopSongs. = ""
  60.       TopSongs.0 = 1
  61.       TopSongs.1 = SongName
  62.     End
  63.     NumBytesSent = NumBytesSent + (Size * Requests / 1024 / 1024)
  64.     NumBytesSent = ((NumBytesSent * 100) % 1) / 100
  65.     NumBytes = NumBytes + Size/1024/1024
  66.     NumBytes = ((NumBytes * 100) % 1) / 100
  67.     NumSecs = NumSecs + Play
  68.     Hours = NumSecs % 3600
  69.     Minutes = (NumSecs % 60) - (Hours * 60)
  70.     Seconds = NumSecs - (Hours * 3600) - (Minutes * 60)
  71.     Playtime = Hours":"Right("00"||Minutes,2)":"Right("00"||Seconds,2)
  72.     Call WriteLn(Out,"  Number of Shared Songs    -=> "NumSongs)
  73.     Call WriteLn(Out,"  Total Megabytes Shared    -=> "NumBytes)
  74.     Call WriteLn(Out,"  Number of Songs Uploaded  -=> "NumReq)
  75.     Call WriteLn(Out,"  Total Megabytes Uploaded  -=> "NumBytesSent)
  76.     Call WriteLn(Out,"  Total Playtime of Library -=> "Playtime)
  77.     Call WriteLn(Out,"A")
  78.   End
  79. Call Close(In)
  80. Call WriteLn(Out,"B")
  81. If TopReq > 0 then Do
  82.   Call WriteLn(Out,"Top Requested Songs: "TopReq" Requests")
  83.   Do Loop = 1 to TopSongs.0
  84.     Call WriteLn(Out,"  "TopSongs.Loop)
  85.   End
  86. End
  87.